package cn.lijiancn01.demo.framework.util;


import java.util.List;

/**
 * 包装 spring BeanUtils
 */
public class BeanUtil {

    private BeanUtil() {
    }

    /**
     * 拷贝对象
     *
     * @param source
     * @param target
     */
    public static void copyBean(Object source, Object target) {
        //忽略值为 null 的属性
        SpringBeanUtil.copyBean(source, target, true);
    }

    /**
     * 拷贝对象
     *
     * @param source
     * @param targetClass
     * @return
     */
    public static <T> T copyBean(Object source, Class<T> targetClass) {
        return SpringBeanUtil.copyBean(source, targetClass);
    }

    /**
     * 拷贝对象列表
     *
     * @param sourceList  待拷贝列表
     * @param targetClass 目标类型
     * @return
     */
    public static <T> List<T> copyList(List<?> sourceList, Class<T> targetClass) {
        return SpringBeanUtil.copyList(sourceList, targetClass);
    }
}